import React,{Component} from 'react';
import {Text,TextInput,Button,View} from 'react-native';

export default class ToDoInput extends Component{
  constructor(){
    super();
    this.state = {myValue:''};
  }

  handlePress=()=>{
    //将当前输入框中的数据发给父组件
    this.props.funcSave(this.state.myValue);
    
  }

  handleChangeText=(msg)=>{
    this.setState({myValue:msg})
  }

  render(){
    return <View>
        <Text>待做事项列表</Text>
        <TextInput 
        onChangeText={this.handleChangeText}
        placeholder='plz input'></TextInput>
        <Button 
        onPress={this.handlePress}
        title='add'></Button>
      </View>
  }
}